<?php
/*
	插件概览		
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'welcome';
if($_RQ['op']=='welcome'){
	$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
	//会员
	$order=array(
		'num'=>$this->count('orderlog',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime)),
		'order_price'=>$this->getsum('orderlog',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime),'order_price'),
		'member'=>$this->count('member',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime)),
		'get_money'=>$this->count('orderlog',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime),'get_money'),
	);
	$return['htmls'][]=array('type'=>'data','one_num'=>3,'title'=>'订单概况','datas'=>array(
		array('title'=>'今日订单数','num'=>1,'data'=>$order['num']),
		array('title'=>'今日订单额','num'=>1,'data'=>$order['order_price']),
		array('title'=>'今日配送员','num'=>1,'data'=>$order['member']),
		array('title'=>'今日配送费','num'=>1,'data'=>$order['get_money']),
	));
	//佣金
	$data=array(
		'num'=>pdo_count('jy_weishop_member',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime)),
		'ordernum'=>$this->count('orderlog',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime),'order_price'),
		'access'=>pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'plugin'=>'jy_peimilk','createtime >'=>$daytime)),
	);
	$return['htmls'][]=array('type'=>'data','one_num'=>4,'title'=>'数据概况','datas'=>array(
		array('title'=>'今日用户','num'=>1,'data'=>$data['num']),
		array('title'=>'今日成交量','num'=>1,'data'=>$data['ordernum']),
		array('title'=>'今日访问统计','num'=>1,'data'=>$data['access']),
	));
	
	$order_pie=array(
		'title'=>'订单概况',
		'tablename'=>$this->tablename('orderlog'),
		'width'=>'50%',
		'field'=>'status',
		'field_options'=>$this->send_status,
		'params'=>array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime),
	);
	$return['htmls'][]=model('core/echart')->pie($order_pie);
	$fee_pie=array(
		'title'=>'今日配送费概况',
		'tablename'=>$this->tablename('orderlog'),
		'width'=>'50%',
		'field'=>'type',
		'field_options'=>$this->feetypes,
		'params'=>array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime),
	);
	$return['htmls'][]=model('core/echart')->pie($fee_pie);
	set_html('title','今日概况');
	exi($return);
}